
<?php
// 访问地址：http://192.168.33.10/CI/index.php/user_control/test

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User_Control extends CI_Controller {

/**
 * 
 * 测试数组参数
 * <form action="http://192.168.33.10/CI/index.php/user_control/test" method="post">
       <input type="text" name="phone[]">
       <input type="text" name="phone[]">
       <input type="text" name="phone[]">
       
       <input type="submit" name="Submit" value="提交" /> 
   </form>

	public function test(){
		$phones = $this->input->post(['phone']);
		print_r($phones);
	}
 *	
 */
	
	public function test(){
		$this->load->model('user_model');
		$r = $this->user_model->test();
		print_r($r);
	}
	
	public function add2(){
		$this->load->helper('url');
		$this->load->view('jjr/regist_bak',$data);
	}
	
	public function add(){
		$this->load->helper('url');
		
		$id = isset($_POST['id'])?$_POST['id']:0;  
		$openId = isset($_POST['openId'])?$_POST['openId']:'';
		$accessToken = isset($_POST['accessToken'])?$_POST['accessToken']:'';
		$name = isset($_POST['name'])?$_POST['name']:'';
		$created = isset($_POST['created'])?$_POST['name']:time();	
		$company = isset($_POST['company'])?$_POST['company']:'';
		$phone = isset($_POST['phone'])?$_POST['phone']:'';
		$province = isset($_POST['province'])?$_POST['province']:'';
		$city = isset($_POST['city'])?$_POST['city']:'';
		$area = isset($_POST['area'])?$_POST['area']:'';
		$provinceId = isset($_POST['provinceId'])?$_POST['provinceId']:'';
		$cityId = isset($_POST['cityId'])?$_POST['cityId']:'';
		$areaId = isset($_POST['areaId'])?$_POST['areaId']:'';	
		$idCard = isset($_POST['idCard'])?$_POST['idCard']:'';
		$bankType = isset($_POST['bankType'])?$_POST['bankType']:0;
		$bankNo = isset($_POST['bankNo'])?$_POST['bankNo']:'';
		$state = isset($_POST['state'])?$_POST['state']:0;
		
		$flag = isset($_POST['flag'])?$_POST['flag']:0;	// 1:为提交态
		
		
		
		
		$user = array("id"=>$id,"openId"=>$openId,"accessToken"=>$accessToken,"name"=>$name,
				"created"=>$created,"company"=>$company,"phone"=>$phone,
				"province"=>$province,"city"=>$city,"area"=>$area,
				"provinceId"=>$provinceId,"cityId"=>$cityId,"areaId"=>$areaId,
				"bankType"=>$bankType,"bankNo"=>$bankNo,"state"=>$state);
		
		
// 		print_r($user);
		
		if($flag==1){
			$this->load->model('user_model');	
			$id = $this->user_model->add($user);
			$user['id']=$id;
		}
		
// 		$data['openId']=0;
		$data['uid']=$id;
		$data['name']=$name;
		$data['state']=$state;
		$data['flag']=$flag;
		$data['title']=' title | 首页';
		
		$data['user']=$user;
		//print_r($data);
		
		$this->load->view('jjr/regist',$data);
		
		
	}
	

	public function update(){
		$this->load->model('j_client');
		$arr = array('usid'=>22,'uname'=>'deng222','upass'=>'1233333');
		$this->j_client->client_update(2,$arr);
	}

	public function delete(){
		$this->load->model('j_client');
		$this->j_client->client_delete(22);
	}

	public function select()
	{
		$this->load->model('j_client');
		$arr = $this->j_client->client_select(14);
		print_r($arr);
		echo $arr[0]->id;

	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */